add tcp-p3 example and test#204
Conversation
| response before exiting. You can give it a response by typing anything you like | ||
| into the terminal where `netcat` is running and then pressing the `Enter` key on | ||
| your keyboard. |
There was a problem hiding this comment.
This does not actually happen, but I'm assuming that's a temporary bug
| recv_rx, recv_fut = sock.receive() | ||
| async def read(): | ||
| with recv_rx: | ||
| data = await recv_rx.read(1024) |
There was a problem hiding this comment.
By some reason, this does not block on empty buffers - I assumed that this would only ever return a non-zero buffer or an error.
For example, if nc is invoked like so:
echo test | nc -l 127.0.0.1 3456
The component receives test.
There is no way to send data to the component via nc after the component has connected.
I am assuming this is a bug in componentize-py?
There was a problem hiding this comment.
According to the spec (https://github.com/WebAssembly/component-model/blob/c7176a512c0bbe4654849f4ba221c1a71c7cf514/design/mvp/Concurrency.md#stream-readiness):
When passed a non-zero-length buffer, the stream.read and stream.write built-ins are "completion-based" (in the style of, e.g., Overlapped I/O or io_uring) in that they complete only once one or more values have been copied to or from the memory buffer passed in at the start of the operation.
1670783 to
c3e69c5
Compare
|
Interesting, the CI just broke a few minutes ago (https://github.com/bytecodealliance/componentize-py/actions/runs/22143392814/job/64013519262?pr=204)
|
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
c3e69c5 to
6a20a40
Compare
Adapt the
tcpexample to p3 usingwasi-socketsAPI directly untilwasi-libc/wasi-sdk/cpythonare further along in p3 support